#pragma once
#include "Control.h"
#include "Container.h"
#include "BaseICtrl.h"

class GUI_API CFAlpProgress :	public CBaseICtrl
{
public:
	CFAlpProgress(void);
	CFAlpProgress(UINT nID);
	CFAlpProgress(wstring strCaption,UINT nID);
	CFAlpProgress(DWORD dwStyle,wstring strCaption, const CRect &rc, UINT nID);
	CFAlpProgress(DWORD dwStyle, wstring strCaption, int x, int y, int cx, int cy, UINT nID);
	virtual ~CFAlpProgress(void);

public:

	void GetRange( int &nMin, int &nMax ) { nMin = m_nMin; nMax = m_nMax; };
	int  GetRangeMax() { return m_nMax; };
	int  GetRangeMin() { return m_nMin; };

	int  GetPos() { return m_nPos; };

	void SetRange( int nMin, int nMax, BOOL bRedraw=FALSE );
	void SetRangeMin(int nMin, BOOL bRedraw = FALSE);
	void SetRangeMax( int nMax, BOOL bRedraw = FALSE );

	void SetPos( int nPos );
	int  SetPageSize( int nSize );


	void SetMargin( int nLeft, int nTop, int nRight, int nBottom );
	void SetMarginTop( int nMargin ) { m_nMarginTop = nMargin; };
	void SetMarginLeft( int nMargin ) { m_nMarginLeft = nMargin; };
	void SetMarginRight( int nMargin ) { m_nMarginRight = nMargin; };
	void SetMarginBottom( int nMargin ) { m_nMarginBottom = nMargin; };

	void SetVertical( BOOL bVertical=TRUE ) { m_bVertical = bVertical; };
	void DrawFocusRect( BOOL bDraw = TRUE, BOOL bRedraw = FALSE );
	// Generated message map functions


	BOOL	SetChannelRes( wstring strResChnl,wstring strResActChnl, CMyUnCompress* pPack=NULL );
	BOOL	SetThumbRes( wstring strResThumb,wstring strResActThumb, CMyUnCompress* pPack=NULL );

protected:

	void Init();
	int Pixel2Pos( int nPixel );
	int Pos2Pixel( int nPos );
	int m_nMax, m_nMin, m_nPos, m_nPage;
	int m_nWidth, m_nHeight;
	int m_nThumbWidth, m_nThumbHeight;
	int m_nMarginLeft, m_nMarginRight, m_nMarginTop, m_nMarginBottom;
	int m_nMouseOffset;

	BOOL m_bVertical;
	BOOL m_bChannelActive, m_bThumbActive;
	BOOL m_bTransparentChannel, m_bThumb, m_bChannel;



	CFAlphaRes*		m_pAlpResChnl;
	CFAlphaRes*		m_pAlpResChnAct;

	CFAlphaRes*		m_pAlpResThumb;
	CFAlphaRes*		m_pAlpResActThumb;

public:
	virtual void Paint(CDC* pDC);
	virtual void Click(DWORD dwClick, POINT pt);
	virtual void  ImprovePaint( HANDLE hDB ,HDC hdc =NULL );




};
